#include <iostream> 
#include <stdlib.h> 
#include <stdio.h>
    using namespace std;
struct snode {
    char * data;
    int top;
};
typedef struct snode * stack;
bool push(char x, stack s);
char pop(stack s);
int main() {
    stack s = new struct snode;
    int judge = 0,i=0;
    s -> data = new char;
    s -> top = -1;
    char ch[30];
    while ((ch[i] = getchar()) != '\n') {
        if (judge == 0&&ch[i]!='('){
            cout << ch[i]; 
			judge = 1;        	
		}
        else if (ch[i] == '+') {
        	if (ch[i -1] == '(')
			continue; 
            while (1) {
                if (s -> data[s -> top] != '('&&s -> top != -1) {
                    cout << " "<< s -> data[s -> top] ;
                    pop(s);
                } else {
                    push(ch[i], s);
                    break;
                }
            }
        }
        else if (ch[i] == '-'){
        	 while (1) {
                if (s -> data[s -> top] != '('&&s -> top != -1) {
                   cout << " "<< s -> data[s -> top] ;
                    pop(s);
                } else {
                    push(ch[i], s);
                    break;
                }
            }
		}
		else if(ch[i] == '*'){
			while (1) {
                if ((s -> data[s -> top] == '/'||s -> data[s -> top] == '*')&&s -> top != -1) {
                    cout << " "<< s -> data[s -> top] ;
                    pop(s);
                } else {
                    push(ch[i], s);
                    break;
                }
            }
		}
		else if(ch[i] == '/'){
			while (1) {
                if ((s -> data[s -> top] == '/'||s -> data[s -> top] == '*')&&s -> top != -1) {
                    cout << " "<< s -> data[s -> top] ;
                    pop(s);
                } else {
                    push(ch[i], s);
                    break;
                }
            }
		}
		else if(ch[i] <='9' && ch[i] >= '0'){
			if(ch[i-1]=='.')
			cout << ch[i-1] << ch[i];
			else if(i == 1&&ch[0] == '-' )
			cout << ch[i] ;
			else if (ch[i-1] <='9' && ch[i-1] >= '0')
			cout << ch[i] ;
			else 
			cout << " " << ch[i] ;
		}
		else if(ch[i] == '('){
			push(ch[i],s);
		}
		else if(ch[i] == ')'){
			while(s -> data[s -> top]!='('){
				cout << " "<< s -> data[s -> top] ;
				pop(s);
			}
			pop(s);
		}
		i++; 
    }
    while(s -> top != -1)
    {
    	cout << " "<< s -> data[s -> top] ;
    	pop(s);
	}
	return 0;
}
bool push(char x, stack s) {
    if (s -> top == 999) {
        cout << "Full";
        return false;
    }
    s -> top++;
    s -> data[s -> top] = x;
    return true;
}
char pop(stack s) {
    if (s -> top == -1)
        return 0;
    return s -> data[s -> top--];
}
 
